package com.itheima.array;

import com.itheima.domain.Student;

import java.util.ArrayList;

public class StudentArray {
    public static void main(String[] args) {
        //创建集合数据类型是学生类型
        ArrayList<Student>list= new ArrayList<>();
        Student stu= new Student("张三1",23);
        Student stu1= new Student("张三2",23);
        Student stu2= new Student("张三3",23);
        Student stu3= new Student("张三4",23);
        //给学生信息添加到集合中
        list.add(stu);
        list.add(stu1);
        list.add(stu2);
        list.add(stu3);
        //遍历集合调用get方法打印每一哥集合元素
        for (int i = 0; i < list.size(); i++) {
            Student s = list.get(i);
            //调用get方法来打印存储的每一个元素
            System.out.println(s.getName()+"..."+s.getAge());
        }
    }
}
